//
//  CollisionListener.h
//  airfight
//
//  Created by USER on 12-9-27.
//  Copyright (c) 2012年 moonriver. All rights reserved.
//

#ifndef airfight_CollisionListener_h
#define airfight_CollisionListener_h

#import"Box2D.h"
#import<vector>
#import<algorithm>
#include "cocos2d.h"
#include "EntitySprite.h"

USING_NS_CC;

struct CollisionContact
{
    b2Fixture *fixtureA;
    b2Fixture *fixtureB;
    bool operator==(const CollisionContact &other) const
    {
        return (fixtureA == other.fixtureA) && (fixtureB == other.fixtureB);
    }
};

class CollisionListener : public b2ContactListener
{
    
public:
    std::vector<CollisionContact> m_Contacts;
    
    CollisionListener();
    ~CollisionListener();
    
    virtual void BeginContact(b2Contact* contact);
    virtual void EndContact(b2Contact* contact);
    virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold); 
    virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse);
    
};


#endif
